package com.its.rabbitMq.utils;


import com.its.rabbitMq.vo.MyMessage;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class SendMessageUtils {
    //依赖注入
    @Autowired
    private RabbitTemplate rabbitTemplate;
    /**
     * 发布异步消息
     */
    public void sendMessage(String exchange, String routingKey, MyMessage myMessage) {
        rabbitTemplate.convertAndSend(exchange, routingKey, myMessage);
    }

}
